﻿namespace TestTool.GUI
{
    using System;
    using System.Windows.Forms;
    using TestTool.GUI.Controllers;
    using TestTool.GUI.Data;
    using TestTool.GUI.Enums;
    using TestTool.GUI.Views;
    using TestTool.Tests.Common.TestEngine;
    using TestTool.Tests.Definitions.Data;
    using TestTool.Tests.Definitions.Interfaces;
    using TestTool.Tests.Definitions.Trace;

    internal class SilentTestView : ITestView, IView
    {
        private int _completedTests;
        private int _failedTests;
        private CompactProcessingForm _form;
        private ConsoleTestResultView _testResultView = new ConsoleTestResultView();
        private int _testsCount;
        private VideoContainer _videoWindow;

        public SilentTestView(CompactProcessingForm form)
        {
            this._form = form;
        }

        public void BeginTest(TestInfo testInfo)
        {
        }

        public void ClearCurrentLog()
        {
        }

        public void ClearTestResults()
        {
        }

        public void DefineTestCount(int count)
        {
            this._testsCount = count;
            this._form.FeatureDefinitionCompleted(count);
        }

        public void EnableTestRun(bool enable)
        {
        }

        public void EndTest(TestResult testResult)
        {
            if (testResult.TestInfo.ProcessType == ProcessType.Test)
            {
                this._completedTests++;
                if (testResult.Log.TestStatus == TestStatus.Failed)
                {
                    this._failedTests++;
                }
                this._form.ReportProgress(this._completedTests, this._failedTests);
            }
        }

        public IController GetController()
        {
            return null;
        }

        public IVideoForm GetVideoForm()
        {
            if (this._videoWindow == null)
            {
                VideoContainer container = new VideoContainer();
                this._videoWindow = container;
            }
            return this._videoWindow;
        }

        public void ReportError(string message)
        {
        }

        public void ReportTestSuiteCompleted()
        {
        }

        public void ShowError(Exception e)
        {
        }

        public void ShowError(string message)
        {
        }

        public void SwitchToState(TestTool.GUI.Enums.ApplicationState state)
        {
        }

        public IFeaturesView FeaturesView
        {
            get
            {
                return null;
            }
        }

        public IProfilesView ProfilesView
        {
            get
            {
                return null;
            }
        }

        public bool Repeat
        {
            get
            {
                return false;
            }
            set
            {
            }
        }

        public ITestResultView TestResultView
        {
            get
            {
                return this._testResultView;
            }
        }

        public ITestTreeView TestTreeView
        {
            get
            {
                return null;
            }
        }

        public Form Window
        {
            get
            {
                return null;
            }
        }
    }
}

